﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="大数据分页存贮过程.aspx.cs" Inherits="SQL存储过程_大数据分页存贮过程" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
    <style type="text/css">

 p.MsoNormal
	{margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	font-size:10.5pt;
	font-family:"Times New Roman";
	        margin-left: 0cm;
            margin-right: 0cm;
            margin-top: 0cm;
        }
 </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;color:green;mso-font-kerning:0pt;mso-no-proof:yes">/****** </span>
            <span style="font-size:10.0pt;font-family:宋体;mso-ascii-font-family:&quot;Courier New&quot;;
mso-hansi-font-family:&quot;Courier New&quot;;mso-bidi-font-family:&quot;Courier New&quot;;
color:green;mso-font-kerning:0pt;mso-no-proof:yes">对象</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:green;mso-font-kerning:
0pt;mso-no-proof:yes">:<span style="mso-spacerun:yes">&nbsp; </span>StoredProcedure 
            [dbo].[FengYe]<span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp; </span></span>
            <span style="font-size:10.0pt;font-family:宋体;mso-ascii-font-family:&quot;Courier New&quot;;
mso-hansi-font-family:&quot;Courier New&quot;;mso-bidi-font-family:&quot;Courier New&quot;;
color:green;mso-font-kerning:0pt;mso-no-proof:yes">脚本日期</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:green;mso-font-kerning:
0pt;mso-no-proof:yes">: 03/04/2008 15:47:15 ******/<o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;color:blue;mso-font-kerning:0pt;mso-no-proof:yes">SET</span><span 
                lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-font-kerning:
0pt;mso-no-proof:yes"> <span style="color:blue">ANSI_NULLS</span> <span style="color:blue">
            ON<o:p></o:p></span></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;mso-font-kerning:0pt;mso-no-proof:yes">GO<o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;color:blue;mso-font-kerning:0pt;mso-no-proof:yes">SET</span><span 
                lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-font-kerning:
0pt;mso-no-proof:yes"> <span style="color:blue">QUOTED_IDENTIFIER</span>
            <span style="color:blue">ON<o:p></o:p></span></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;mso-font-kerning:0pt;mso-no-proof:yes">GO<o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;color:blue;mso-font-kerning:0pt;mso-no-proof:yes">CREATE</span><span 
                lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-font-kerning:
0pt;mso-no-proof:yes"> <span style="color:blue">PROCEDURE</span> [dbo]<span 
                style="color:gray">.</span>[FengYe]<o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;mso-font-kerning:0pt;mso-no-proof:yes">
            <span style="mso-spacerun:yes">&nbsp; </span>@tb<span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            </span><span style="color:blue">varchar</span><span style="color:gray">(</span>50<span 
                style="color:gray">),</span> <span style="color:green">--</span></span><span style="font-size:10.0pt;font-family:宋体;mso-ascii-font-family:&quot;Courier New&quot;;
mso-hansi-font-family:&quot;Courier New&quot;;mso-bidi-font-family:&quot;Courier New&quot;;
color:green;mso-font-kerning:0pt;mso-no-proof:yes">表名</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:green;mso-font-kerning:
0pt;mso-no-proof:yes"><o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;mso-font-kerning:0pt;mso-no-proof:yes">
            <span style="mso-spacerun:yes">&nbsp; </span>@col<span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            </span><span style="color:blue">varchar</span><span style="color:gray">(</span>50<span 
                style="color:gray">),</span> <span style="color:green">--</span></span><span style="font-size:10.0pt;font-family:宋体;mso-ascii-font-family:&quot;Courier New&quot;;
mso-hansi-font-family:&quot;Courier New&quot;;mso-bidi-font-family:&quot;Courier New&quot;;
color:green;mso-font-kerning:0pt;mso-no-proof:yes">按该列来进行分页</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:green;
mso-font-kerning:0pt;mso-no-proof:yes"><o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;mso-font-kerning:0pt;mso-no-proof:yes">
            <span style="mso-spacerun:yes">&nbsp; </span>@coltype<span 
                style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp; </span><span style="color:blue">
            int</span><span style="color:gray">,</span><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            </span><span style="color:green">--@col</span></span><span style="font-size:10.0pt;font-family:宋体;mso-ascii-font-family:&quot;Courier New&quot;;
mso-hansi-font-family:&quot;Courier New&quot;;mso-bidi-font-family:&quot;Courier New&quot;;
color:green;mso-font-kerning:0pt;mso-no-proof:yes">列的类型</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:green;mso-font-kerning:
0pt;mso-no-proof:yes">,0-</span><span style="font-size:10.0pt;font-family:宋体;
mso-ascii-font-family:&quot;Courier New&quot;;mso-hansi-font-family:&quot;Courier New&quot;;
mso-bidi-font-family:&quot;Courier New&quot;;color:green;mso-font-kerning:0pt;mso-no-proof:
yes">数字类型</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;
color:green;mso-font-kerning:0pt;mso-no-proof:yes">,1-</span><span style="font-size:10.0pt;font-family:宋体;mso-ascii-font-family:&quot;Courier New&quot;;
mso-hansi-font-family:&quot;Courier New&quot;;mso-bidi-font-family:&quot;Courier New&quot;;
color:green;mso-font-kerning:0pt;mso-no-proof:yes">字符类型</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:green;mso-font-kerning:
0pt;mso-no-proof:yes">,2-</span><span style="font-size:10.0pt;font-family:宋体;
mso-ascii-font-family:&quot;Courier New&quot;;mso-hansi-font-family:&quot;Courier New&quot;;
mso-bidi-font-family:&quot;Courier New&quot;;color:green;mso-font-kerning:0pt;mso-no-proof:
yes">日期时间类型</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;
color:green;mso-font-kerning:0pt;mso-no-proof:yes"><o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;mso-font-kerning:0pt;mso-no-proof:yes">
            <span style="mso-spacerun:yes">&nbsp; </span>@orderby<span 
                style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp; </span><span style="color:blue">
            bit</span><span style="color:gray">,</span><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            </span><span style="color:green">--</span></span><span style="font-size:10.0pt;font-family:宋体;mso-ascii-font-family:&quot;Courier New&quot;;
mso-hansi-font-family:&quot;Courier New&quot;;mso-bidi-font-family:&quot;Courier New&quot;;
color:green;mso-font-kerning:0pt;mso-no-proof:yes">排序</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:green;mso-font-kerning:
0pt;mso-no-proof:yes">,0-</span><span style="font-size:10.0pt;font-family:宋体;
mso-ascii-font-family:&quot;Courier New&quot;;mso-hansi-font-family:&quot;Courier New&quot;;
mso-bidi-font-family:&quot;Courier New&quot;;color:green;mso-font-kerning:0pt;mso-no-proof:
yes">顺序</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;
color:green;mso-font-kerning:0pt;mso-no-proof:yes">,1-</span><span style="font-size:10.0pt;font-family:宋体;mso-ascii-font-family:&quot;Courier New&quot;;
mso-hansi-font-family:&quot;Courier New&quot;;mso-bidi-font-family:&quot;Courier New&quot;;
color:green;mso-font-kerning:0pt;mso-no-proof:yes">倒序</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:green;mso-font-kerning:
0pt;mso-no-proof:yes"><o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;mso-font-kerning:0pt;mso-no-proof:yes">
            <span style="mso-spacerun:yes">&nbsp; </span>@collist<span 
                style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp; </span><span style="color:blue">
            varchar</span><span style="color:gray">(</span>800<span style="color:gray">),</span><span 
                style="color:green">--</span></span><span style="font-size:10.0pt;font-family:宋体;mso-ascii-font-family:&quot;Courier New&quot;;
mso-hansi-font-family:&quot;Courier New&quot;;mso-bidi-font-family:&quot;Courier New&quot;;
color:green;mso-font-kerning:0pt;mso-no-proof:yes">要查询出的字段列表</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:green;
mso-font-kerning:0pt;mso-no-proof:yes">,*</span><span style="font-size:10.0pt;
font-family:宋体;mso-ascii-font-family:&quot;Courier New&quot;;mso-hansi-font-family:&quot;Courier New&quot;;
mso-bidi-font-family:&quot;Courier New&quot;;color:green;mso-font-kerning:0pt;mso-no-proof:
yes">表示全部字段</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;
color:green;mso-font-kerning:0pt;mso-no-proof:yes"><o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;mso-font-kerning:0pt;mso-no-proof:yes">
            <span style="mso-spacerun:yes">&nbsp; </span>@pagesize<span 
                style="mso-spacerun:yes">&nbsp;&nbsp; </span><span style="color:blue">int</span><span 
                style="color:gray">,</span><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            </span><span style="color:green">--</span></span><span style="font-size:10.0pt;font-family:宋体;mso-ascii-font-family:&quot;Courier New&quot;;
mso-hansi-font-family:&quot;Courier New&quot;;mso-bidi-font-family:&quot;Courier New&quot;;
color:green;mso-font-kerning:0pt;mso-no-proof:yes">每页记录数</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:green;
mso-font-kerning:0pt;mso-no-proof:yes"><o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;mso-font-kerning:0pt;mso-no-proof:yes">
            <span style="mso-spacerun:yes">&nbsp; </span>@page<span 
                style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
            <span style="color:blue">int</span><span style="color:gray">,</span><span 
                style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            </span><span style="color:green">--</span></span><span style="font-size:10.0pt;font-family:宋体;mso-ascii-font-family:&quot;Courier New&quot;;
mso-hansi-font-family:&quot;Courier New&quot;;mso-bidi-font-family:&quot;Courier New&quot;;
color:green;mso-font-kerning:0pt;mso-no-proof:yes">指定页</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:green;mso-font-kerning:
0pt;mso-no-proof:yes"><o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;mso-font-kerning:0pt;mso-no-proof:yes">
            <span style="mso-spacerun:yes">&nbsp; </span>@condition<span 
                style="mso-spacerun:yes">&nbsp; </span><span style="color:blue">varchar</span><span 
                style="color:gray">(</span>800<span style="color:gray">),</span><span 
                style="color:green">--</span></span><span style="font-size:10.0pt;font-family:宋体;mso-ascii-font-family:&quot;Courier New&quot;;
mso-hansi-font-family:&quot;Courier New&quot;;mso-bidi-font-family:&quot;Courier New&quot;;
color:green;mso-font-kerning:0pt;mso-no-proof:yes">查询条件</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:green;mso-font-kerning:
0pt;mso-no-proof:yes"><o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;mso-font-kerning:0pt;mso-no-proof:yes">
            <span style="mso-spacerun:yes">&nbsp; </span>@pages<span 
                style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
            <span style="color:blue">int</span> <span style="color:blue">OUTPUT</span><span 
                style="mso-spacerun:yes">&nbsp;&nbsp; </span><span style="color:green">--</span></span><span style="font-size:10.0pt;font-family:宋体;mso-ascii-font-family:&quot;Courier New&quot;;
mso-hansi-font-family:&quot;Courier New&quot;;mso-bidi-font-family:&quot;Courier New&quot;;
color:green;mso-font-kerning:0pt;mso-no-proof:yes">总页数</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:green;mso-font-kerning:
0pt;mso-no-proof:yes"><o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;color:blue;mso-font-kerning:0pt;mso-no-proof:yes">AS<o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;color:green;mso-font-kerning:0pt;mso-no-proof:yes">/*<o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span style="font-size:10.0pt;font-family:宋体;
mso-ascii-font-family:&quot;Courier New&quot;;mso-hansi-font-family:&quot;Courier New&quot;;
mso-bidi-font-family:&quot;Courier New&quot;;color:green;mso-font-kerning:0pt;mso-no-proof:
yes">功能描述：对指定表中满足条件的记录按指定列进行分页查询，分页可以顺序、倒序</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:green;mso-font-kerning:
0pt;mso-no-proof:yes"><o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;color:green;mso-font-kerning:0pt;mso-no-proof:yes">
            <span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            </span></span>
            <span style="font-size:10.0pt;
font-family:宋体;mso-ascii-font-family:&quot;Courier New&quot;;mso-hansi-font-family:&quot;Courier New&quot;;
mso-bidi-font-family:&quot;Courier New&quot;;color:green;mso-font-kerning:0pt;mso-no-proof:
yes">查询可以指定页大小、指定查询任意页、指定输出字段列表，返回总页数</span><span lang="EN-US" style="font-size:
10.0pt;font-family:&quot;Courier New&quot;;color:green;mso-font-kerning:0pt;mso-no-proof:
yes"><o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span style="font-size:10.0pt;font-family:宋体;
mso-ascii-font-family:&quot;Courier New&quot;;mso-hansi-font-family:&quot;Courier New&quot;;
mso-bidi-font-family:&quot;Courier New&quot;;color:green;mso-font-kerning:0pt;mso-no-proof:
yes">作</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;
color:green;mso-font-kerning:0pt;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp;&nbsp;
            </span></span>
            <span style="font-size:10.0pt;
font-family:宋体;mso-ascii-font-family:&quot;Courier New&quot;;mso-hansi-font-family:&quot;Courier New&quot;;
mso-bidi-font-family:&quot;Courier New&quot;;color:green;mso-font-kerning:0pt;mso-no-proof:
yes">者：</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;
color:green;mso-font-kerning:0pt;mso-no-proof:yes">pbsql<o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span style="font-size:10.0pt;font-family:宋体;
mso-ascii-font-family:&quot;Courier New&quot;;mso-hansi-font-family:&quot;Courier New&quot;;
mso-bidi-font-family:&quot;Courier New&quot;;color:green;mso-font-kerning:0pt;mso-no-proof:
yes">版</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;
color:green;mso-font-kerning:0pt;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp;&nbsp;
            </span></span>
            <span style="font-size:10.0pt;
font-family:宋体;mso-ascii-font-family:&quot;Courier New&quot;;mso-hansi-font-family:&quot;Courier New&quot;;
mso-bidi-font-family:&quot;Courier New&quot;;color:green;mso-font-kerning:0pt;mso-no-proof:
yes">本：</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;
color:green;mso-font-kerning:0pt;mso-no-proof:yes">.10<o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span style="font-size:10.0pt;font-family:宋体;
mso-ascii-font-family:&quot;Courier New&quot;;mso-hansi-font-family:&quot;Courier New&quot;;
mso-bidi-font-family:&quot;Courier New&quot;;color:green;mso-font-kerning:0pt;mso-no-proof:
yes">最后修改：</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;
color:green;mso-font-kerning:0pt;mso-no-proof:yes">-11-29<o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;color:green;mso-font-kerning:0pt;mso-no-proof:yes">*/<o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;color:blue;mso-font-kerning:0pt;mso-no-proof:yes">DECLARE</span><span 
                lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-font-kerning:
0pt;mso-no-proof:yes"> @sql <span style="color:blue">nvarchar</span><span 
                style="color:gray">(</span>4000<span style="color:gray">),</span>@where1
            <span style="color:blue">varchar</span><span style="color:gray">(</span>800<span 
                style="color:gray">),</span>@where2 <span style="color:blue">varchar</span><span 
                style="color:gray">(</span>800<span style="color:gray">)<o:p></o:p></span></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;color:blue;mso-font-kerning:0pt;mso-no-proof:yes">IF</span><span 
                lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-font-kerning:
0pt;mso-no-proof:yes"> @condition <span style="color:gray">is</span>
            <span style="color:gray">null</span> <span style="color:gray">or</span>
            <span style="color:fuchsia">rtrim</span><span style="color:gray">(</span>@condition<span 
                style="color:gray">)=</span><span style="color:red">&#39;&#39;<o:p></o:p></span></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;color:blue;mso-font-kerning:0pt;mso-no-proof:yes">BEGIN</span><span 
                lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:green;
mso-font-kerning:0pt;mso-no-proof:yes">--</span><span style="font-size:10.0pt;
font-family:宋体;mso-ascii-font-family:&quot;Courier New&quot;;mso-hansi-font-family:&quot;Courier New&quot;;
mso-bidi-font-family:&quot;Courier New&quot;;color:green;mso-font-kerning:0pt;mso-no-proof:
yes">没有查询条件</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;
color:green;mso-font-kerning:0pt;mso-no-proof:yes"><o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;mso-font-kerning:0pt;mso-no-proof:yes">
            <span style="mso-spacerun:yes">&nbsp; </span><span style="color:blue">SET</span> 
            @where1<span style="color:gray">=</span><span style="color:red">&#39; WHERE &#39;<o:p></o:p></span></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;mso-font-kerning:0pt;mso-no-proof:yes">
            <span style="mso-spacerun:yes">&nbsp; </span><span style="color:blue">SET</span> 
            @where2<span style="color:gray">=</span><span style="color:red">&#39;<span 
                style="mso-spacerun:yes">&nbsp; </span>&#39;<o:p></o:p></span></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;color:blue;mso-font-kerning:0pt;mso-no-proof:yes">END<o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;color:blue;mso-font-kerning:0pt;mso-no-proof:yes">ELSE<o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;color:blue;mso-font-kerning:0pt;mso-no-proof:yes">BEGIN</span><span 
                lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:green;
mso-font-kerning:0pt;mso-no-proof:yes">--</span><span style="font-size:10.0pt;
font-family:宋体;mso-ascii-font-family:&quot;Courier New&quot;;mso-hansi-font-family:&quot;Courier New&quot;;
mso-bidi-font-family:&quot;Courier New&quot;;color:green;mso-font-kerning:0pt;mso-no-proof:
yes">有查询条件</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;
color:green;mso-font-kerning:0pt;mso-no-proof:yes"><o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;mso-font-kerning:0pt;mso-no-proof:yes">
            <span style="mso-spacerun:yes">&nbsp; </span><span style="color:blue">SET</span> 
            @where1<span style="color:gray">=</span><span style="color:red">&#39; WHERE (&#39;</span><span 
                style="color:gray">+</span>@condition<span style="color:gray">+</span><span 
                style="color:red">&#39;) AND &#39;</span><span style="color:green">--</span></span><span style="font-size:10.0pt;font-family:宋体;mso-ascii-font-family:&quot;Courier New&quot;;
mso-hansi-font-family:&quot;Courier New&quot;;mso-bidi-font-family:&quot;Courier New&quot;;
color:green;mso-font-kerning:0pt;mso-no-proof:yes">本来有条件再加上此条件</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:green;
mso-font-kerning:0pt;mso-no-proof:yes"><o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;mso-font-kerning:0pt;mso-no-proof:yes">
            <span style="mso-spacerun:yes">&nbsp; </span><span style="color:blue">SET</span> 
            @where2<span style="color:gray">=</span><span style="color:red">&#39; WHERE (&#39;</span><span 
                style="color:gray">+</span>@condition<span style="color:gray">+</span><span 
                style="color:red">&#39;) &#39;</span><span style="color:green">--</span></span><span style="font-size:10.0pt;font-family:宋体;mso-ascii-font-family:&quot;Courier New&quot;;
mso-hansi-font-family:&quot;Courier New&quot;;mso-bidi-font-family:&quot;Courier New&quot;;
color:green;mso-font-kerning:0pt;mso-no-proof:yes">原本没有条件而加上此条件</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:green;
mso-font-kerning:0pt;mso-no-proof:yes"><o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;color:blue;mso-font-kerning:0pt;mso-no-proof:yes">END<o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;color:blue;mso-font-kerning:0pt;mso-no-proof:yes">SET</span><span 
                lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-font-kerning:
0pt;mso-no-proof:yes"> @sql<span style="color:gray">=</span><span style="color:red">&#39;SELECT 
            @pages=CEILING((COUNT(*)+0.0)/&#39;</span><span style="color:gray">+</span><span 
                style="color:fuchsia">CAST</span><span style="color:gray">(</span>@pagesize
            <span style="color:blue">AS</span> <span style="color:blue">varchar</span><span 
                style="color:gray">)+<o:p></o:p></span></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;mso-font-kerning:0pt;mso-no-proof:yes">
            <span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            </span><span style="color:red">&#39;) FROM &#39;</span><span style="color:gray">+</span>@tb<span 
                style="color:gray">+</span>@where2<o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;color:blue;mso-font-kerning:0pt;mso-no-proof:yes">EXEC</span><span 
                lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-font-kerning:
0pt;mso-no-proof:yes"> <span style="color:maroon">sp_executesql</span> @sql<span 
                style="color:gray">,</span>N<span style="color:red">&#39;@pages int OUTPUT&#39;</span><span 
                style="color:gray">,</span>@pages <span style="color:blue">OUTPUT</span><span 
                style="color:green">--</span></span><span style="font-size:10.0pt;font-family:
宋体;mso-ascii-font-family:&quot;Courier New&quot;;mso-hansi-font-family:&quot;Courier New&quot;;
mso-bidi-font-family:&quot;Courier New&quot;;color:green;mso-font-kerning:0pt;mso-no-proof:
yes">计算总页数</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;
color:green;mso-font-kerning:0pt;mso-no-proof:yes"><o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;color:blue;mso-font-kerning:0pt;mso-no-proof:yes">IF</span><span 
                lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-font-kerning:
0pt;mso-no-proof:yes"> @orderby<span style="color:gray">=</span>0<o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;mso-font-kerning:0pt;mso-no-proof:yes">
            <span style="mso-spacerun:yes">&nbsp; </span><span style="color:blue">SET</span> 
            @sql<span style="color:gray">=</span><span style="color:red">&#39;SELECT TOP &#39;</span><span 
                style="color:gray">+</span><span style="color:fuchsia">CAST</span><span 
                style="color:gray">(</span>@pagesize <span style="color:blue">AS</span>
            <span style="color:blue">varchar</span><span style="color:gray">)+</span><span 
                style="color:red">&#39; &#39;</span><span style="color:gray">+</span>@collist<span 
                style="color:gray">+<o:p></o:p></span></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;mso-font-kerning:0pt;mso-no-proof:yes">
            <span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            </span><span style="color:red">&#39; FROM &#39;</span><span style="color:gray">+</span>@tb<span 
                style="color:gray">+</span>@where1<span style="color:gray">+</span>@col<span 
                style="color:gray">+</span><span style="color:red">&#39;&gt;(SELECT MAX(&#39;</span><span 
                style="color:gray">+</span>@col<span style="color:gray">+</span><span 
                style="color:red">&#39;) &#39;</span><span style="color:gray">+<o:p></o:p></span></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;mso-font-kerning:0pt;mso-no-proof:yes">
            <span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            </span><span style="color:red">&#39; FROM (SELECT TOP &#39;</span><span 
                style="color:gray">+</span><span style="color:fuchsia">CAST</span><span 
                style="color:gray">(</span>@pagesize<span style="color:gray">*(</span>@page<span 
                style="color:gray">-</span>1<span style="color:gray">)</span>
            <span style="color:blue">AS</span> <span style="color:blue">varchar</span><span 
                style="color:gray">)+</span><span style="color:red">&#39; &#39;</span><span 
                style="color:gray">+<o:p></o:p></span></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;mso-font-kerning:0pt;mso-no-proof:yes">
            <span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            </span>@col<span style="color:gray">+</span><span style="color:red">&#39; FROM &#39;</span><span 
                style="color:gray">+</span>@tb<span style="color:gray">+</span>@where2<span 
                style="color:gray">+</span><span style="color:red">&#39;ORDER BY &#39;</span><span 
                style="color:gray">+</span>@col<span style="color:gray">+</span><span 
                style="color:red">&#39;) t) ORDER BY &#39;</span><span style="color:gray">+</span>@col<o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;color:blue;mso-font-kerning:0pt;mso-no-proof:yes">ELSE<o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;mso-font-kerning:0pt;mso-no-proof:yes">
            <span style="mso-spacerun:yes">&nbsp; </span><span style="color:blue">SET</span> 
            @sql<span style="color:gray">=</span><span style="color:red">&#39;SELECT TOP &#39;</span><span 
                style="color:gray">+</span><span style="color:fuchsia">CAST</span><span 
                style="color:gray">(</span>@pagesize <span style="color:blue">AS</span>
            <span style="color:blue">varchar</span><span style="color:gray">)+</span><span 
                style="color:red">&#39; &#39;</span><span style="color:gray">+</span>@collist<span 
                style="color:gray">+<o:p></o:p></span></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;mso-font-kerning:0pt;mso-no-proof:yes">
            <span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            </span><span style="color:red">&#39; FROM &#39;</span><span style="color:gray">+</span>@tb<span 
                style="color:gray">+</span>@where1<span style="color:gray">+</span>@col<span 
                style="color:gray">+</span><span style="color:red">&#39;&lt;(SELECT MIN(&#39;</span><span 
                style="color:gray">+</span>@col<span style="color:gray">+</span><span 
                style="color:red">&#39;) &#39;</span><span style="color:gray">+<o:p></o:p></span></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;mso-font-kerning:0pt;mso-no-proof:yes">
            <span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            </span><span style="color:red">&#39; FROM (SELECT TOP &#39;</span><span 
                style="color:gray">+</span><span style="color:fuchsia">CAST</span><span 
                style="color:gray">(</span>@pagesize<span style="color:gray">*(</span>@page<span 
                style="color:gray">-</span>1<span style="color:gray">)</span>
            <span style="color:blue">AS</span> <span style="color:blue">varchar</span><span 
                style="color:gray">)+</span><span style="color:red">&#39; &#39;</span><span 
                style="color:gray">+<o:p></o:p></span></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;mso-font-kerning:0pt;mso-no-proof:yes">
            <span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            </span>@col<span style="color:gray">+</span><span style="color:red">&#39; FROM &#39;</span><span 
                style="color:gray">+</span>@tb<span style="color:gray">+</span>@where2<span 
                style="color:gray">+</span><span style="color:red">&#39;ORDER BY &#39;</span><span 
                style="color:gray">+</span>@col<span style="color:gray">+</span><span 
                style="color:red">&#39; DESC) t) ORDER BY &#39;</span><span style="color:gray">+<o:p></o:p></span></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;mso-font-kerning:0pt;mso-no-proof:yes">
            <span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            </span>@col<span style="color:gray">+</span><span style="color:red">&#39; DESC&#39;<o:p></o:p></span></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;color:blue;mso-font-kerning:0pt;mso-no-proof:yes">IF</span><span 
                lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-font-kerning:
0pt;mso-no-proof:yes"> @page<span style="color:gray">=</span>1<span style="color:green">--</span></span><span style="font-size:10.0pt;font-family:
宋体;mso-ascii-font-family:&quot;Courier New&quot;;mso-hansi-font-family:&quot;Courier New&quot;;
mso-bidi-font-family:&quot;Courier New&quot;;color:green;mso-font-kerning:0pt;mso-no-proof:
yes">第一页</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;
color:green;mso-font-kerning:0pt;mso-no-proof:yes"><o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;mso-font-kerning:0pt;mso-no-proof:yes">
            <span style="mso-spacerun:yes">&nbsp; </span><span style="color:blue">SET</span> 
            @sql<span style="color:gray">=</span><span style="color:red">&#39;SELECT TOP &#39;</span><span 
                style="color:gray">+</span><span style="color:fuchsia">CAST</span><span 
                style="color:gray">(</span>@pagesize <span style="color:blue">AS</span>
            <span style="color:blue">varchar</span><span style="color:gray">)+</span><span 
                style="color:red">&#39; &#39;</span><span style="color:gray">+</span>@collist<span 
                style="color:gray">+</span><span style="color:red">&#39; FROM &#39;</span><span 
                style="color:gray">+</span>@tb<span style="color:gray">+<o:p></o:p></span></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;mso-font-kerning:0pt;mso-no-proof:yes">
            <span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp; </span>@where2<span 
                style="color:gray">+</span><span style="color:red">&#39;ORDER BY &#39;</span><span 
                style="color:gray">+</span>@col<span style="color:gray">+</span><span 
                style="color:blue">CASE</span> @orderby <span style="color:blue">WHEN</span> 
            0 <span style="color:blue">THEN</span> <span style="color:red">&#39;&#39;</span>
            <span style="color:blue">ELSE</span> <span style="color:red">&#39; DESC&#39;</span>
            <span style="color:blue">END<o:p></o:p></span></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;color:blue;mso-font-kerning:0pt;mso-no-proof:yes">EXEC</span><span 
                lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:gray;
mso-font-kerning:0pt;mso-no-proof:yes">(</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-font-kerning:0pt;
mso-no-proof:yes">@sql<span style="color:gray">)<o:p></o:p></span></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;color:green;mso-font-kerning:0pt;mso-no-proof:yes">--print @sql<o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;color:green;mso-font-kerning:0pt;mso-no-proof:yes"><o:p>&nbsp;</o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;color:green;mso-font-kerning:0pt;mso-no-proof:yes"><o:p>&nbsp;</o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;color:green;mso-font-kerning:0pt;mso-no-proof:yes">--</span><span style="font-size:10.0pt;font-family:宋体;mso-ascii-font-family:&quot;Courier New&quot;;
mso-hansi-font-family:&quot;Courier New&quot;;mso-bidi-font-family:&quot;Courier New&quot;;
color:green;mso-font-kerning:0pt;mso-no-proof:yes">本存储过程高效，曾用万条数据测试（已建索引），只返回分页只需秒，影响效率的地方是计算总页数，若不需要可以注释掉</span><span 
                lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:green;
mso-font-kerning:0pt;mso-no-proof:yes"><o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;color:green;mso-font-kerning:0pt;mso-no-proof:yes">--<o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;color:green;mso-font-kerning:0pt;mso-no-proof:yes">----</span><span style="font-size:10.0pt;font-family:宋体;mso-ascii-font-family:&quot;Courier New&quot;;
mso-hansi-font-family:&quot;Courier New&quot;;mso-bidi-font-family:&quot;Courier New&quot;;
color:green;mso-font-kerning:0pt;mso-no-proof:yes">测试示例</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:green;mso-font-kerning:
0pt;mso-no-proof:yes"><o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;color:green;mso-font-kerning:0pt;mso-no-proof:yes">--declare @pages 
            int<o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;color:green;mso-font-kerning:0pt;mso-no-proof:yes">--select 
            identity(int,1,1) id,getdate() dt,xx=cast(&#39;&#39; as varchar(10)) into #t<o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;color:green;mso-font-kerning:0pt;mso-no-proof:yes">-- from 
            sysobjects<o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;color:green;mso-font-kerning:0pt;mso-no-proof:yes">--update #t set 
            dt=dateadd(day,id-200,dt),<o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;color:green;mso-font-kerning:0pt;mso-no-proof:yes">--<span 
                style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            </span>xx=&#39;xxxx&#39;+right(&#39;000000&#39;+cast(id as varchar(10)),6)<o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;color:green;mso-font-kerning:0pt;mso-no-proof:yes">--<o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;color:green;mso-font-kerning:0pt;mso-no-proof:yes">--exec sp_page 
            &#39;#t&#39;,&#39;id&#39;,0,0,&#39;*&#39;,10,2,&#39;&#39;,@pages output--</span><span style="font-size:10.0pt;
font-family:宋体;mso-ascii-font-family:&quot;Courier New&quot;;mso-hansi-font-family:&quot;Courier New&quot;;
mso-bidi-font-family:&quot;Courier New&quot;;color:green;mso-font-kerning:0pt;mso-no-proof:
yes">按</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;
color:green;mso-font-kerning:0pt;mso-no-proof:yes">id</span><span style="font-size:10.0pt;font-family:宋体;mso-ascii-font-family:&quot;Courier New&quot;;
mso-hansi-font-family:&quot;Courier New&quot;;mso-bidi-font-family:&quot;Courier New&quot;;
color:green;mso-font-kerning:0pt;mso-no-proof:yes">顺序取第二页</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:green;
mso-font-kerning:0pt;mso-no-proof:yes"><o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;color:green;mso-font-kerning:0pt;mso-no-proof:yes">--exec sp_page 
            &#39;#t&#39;,&#39;id&#39;,0,1,&#39;*&#39;,10,2,&#39;&#39;,@pages output--</span><span style="font-size:10.0pt;
font-family:宋体;mso-ascii-font-family:&quot;Courier New&quot;;mso-hansi-font-family:&quot;Courier New&quot;;
mso-bidi-font-family:&quot;Courier New&quot;;color:green;mso-font-kerning:0pt;mso-no-proof:
yes">按</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;
color:green;mso-font-kerning:0pt;mso-no-proof:yes">id</span><span style="font-size:10.0pt;font-family:宋体;mso-ascii-font-family:&quot;Courier New&quot;;
mso-hansi-font-family:&quot;Courier New&quot;;mso-bidi-font-family:&quot;Courier New&quot;;
color:green;mso-font-kerning:0pt;mso-no-proof:yes">倒序取第二页</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:green;
mso-font-kerning:0pt;mso-no-proof:yes"><o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;color:green;mso-font-kerning:0pt;mso-no-proof:yes">--exec sp_page 
            &#39;#t&#39;,&#39;xx&#39;,1,0,&#39;*&#39;,10,3,&#39;&#39;,@pages output--</span><span style="font-size:10.0pt;
font-family:宋体;mso-ascii-font-family:&quot;Courier New&quot;;mso-hansi-font-family:&quot;Courier New&quot;;
mso-bidi-font-family:&quot;Courier New&quot;;color:green;mso-font-kerning:0pt;mso-no-proof:
yes">按</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;
color:green;mso-font-kerning:0pt;mso-no-proof:yes">xx</span><span style="font-size:10.0pt;font-family:宋体;mso-ascii-font-family:&quot;Courier New&quot;;
mso-hansi-font-family:&quot;Courier New&quot;;mso-bidi-font-family:&quot;Courier New&quot;;
color:green;mso-font-kerning:0pt;mso-no-proof:yes">顺序取第三页</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:green;
mso-font-kerning:0pt;mso-no-proof:yes"><o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;color:green;mso-font-kerning:0pt;mso-no-proof:yes">--exec sp_page 
            &#39;#t&#39;,&#39;xx&#39;,1,1,&#39;*&#39;,10,3,&#39;&#39;,@pages output--</span><span style="font-size:10.0pt;
font-family:宋体;mso-ascii-font-family:&quot;Courier New&quot;;mso-hansi-font-family:&quot;Courier New&quot;;
mso-bidi-font-family:&quot;Courier New&quot;;color:green;mso-font-kerning:0pt;mso-no-proof:
yes">按</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;
color:green;mso-font-kerning:0pt;mso-no-proof:yes">xx</span><span style="font-size:10.0pt;font-family:宋体;mso-ascii-font-family:&quot;Courier New&quot;;
mso-hansi-font-family:&quot;Courier New&quot;;mso-bidi-font-family:&quot;Courier New&quot;;
color:green;mso-font-kerning:0pt;mso-no-proof:yes">倒序取第三页</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:green;
mso-font-kerning:0pt;mso-no-proof:yes"><o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;color:green;mso-font-kerning:0pt;mso-no-proof:yes">--exec sp_page 
            &#39;#t&#39;,&#39;dt&#39;,2,0,&#39;*&#39;,10,2,&#39;&#39;,@pages output--</span><span style="font-size:10.0pt;
font-family:宋体;mso-ascii-font-family:&quot;Courier New&quot;;mso-hansi-font-family:&quot;Courier New&quot;;
mso-bidi-font-family:&quot;Courier New&quot;;color:green;mso-font-kerning:0pt;mso-no-proof:
yes">按</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;
color:green;mso-font-kerning:0pt;mso-no-proof:yes">dt</span><span style="font-size:10.0pt;font-family:宋体;mso-ascii-font-family:&quot;Courier New&quot;;
mso-hansi-font-family:&quot;Courier New&quot;;mso-bidi-font-family:&quot;Courier New&quot;;
color:green;mso-font-kerning:0pt;mso-no-proof:yes">顺序取第二页</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:green;
mso-font-kerning:0pt;mso-no-proof:yes"><o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;color:green;mso-font-kerning:0pt;mso-no-proof:yes">--exec sp_page 
            &#39;#t&#39;,&#39;dt&#39;,2,1,&#39;*&#39;,10,2,&#39;&#39;,@pages output--</span><span style="font-size:10.0pt;
font-family:宋体;mso-ascii-font-family:&quot;Courier New&quot;;mso-hansi-font-family:&quot;Courier New&quot;;
mso-bidi-font-family:&quot;Courier New&quot;;color:green;mso-font-kerning:0pt;mso-no-proof:
yes">按</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;
color:green;mso-font-kerning:0pt;mso-no-proof:yes">dt</span><span style="font-size:10.0pt;font-family:宋体;mso-ascii-font-family:&quot;Courier New&quot;;
mso-hansi-font-family:&quot;Courier New&quot;;mso-bidi-font-family:&quot;Courier New&quot;;
color:green;mso-font-kerning:0pt;mso-no-proof:yes">倒序取第二页</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:green;
mso-font-kerning:0pt;mso-no-proof:yes"><o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;color:green;mso-font-kerning:0pt;mso-no-proof:yes">--<o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;color:green;mso-font-kerning:0pt;mso-no-proof:yes">--select </span>
            <span style="font-size:10.0pt;font-family:宋体;mso-ascii-font-family:&quot;Courier New&quot;;
mso-hansi-font-family:&quot;Courier New&quot;;mso-bidi-font-family:&quot;Courier New&quot;;
color:green;mso-font-kerning:0pt;mso-no-proof:yes">总页数</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:green;mso-font-kerning:
0pt;mso-no-proof:yes">=@pages<o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;color:green;mso-font-kerning:0pt;mso-no-proof:yes">--<o:p></o:p></span></p>
        <p align="left" class="MsoNormal" style="text-align:left;mso-layout-grid-align:
none;text-autospace:none">
            <span lang="EN-US" style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;color:green;mso-font-kerning:0pt;mso-no-proof:yes">--drop table #t<o:p></o:p></span></p>
        <p class="MsoNormal">
            <span lang="EN-US"><o:p>&nbsp;</o:p></span></p>
    
    </div>
    </form>
</body>
</html>
